import { Message } from '@arco-design/web-react';
import { apiOperateCard } from '../../../api';
import { CardDetail } from './types';
import { AxiosResponse } from 'axios';
import LoadingMask from '../../../components/loadingMask';
// 刷新单张卡的全部数据
export async function handleRefreshSystemData(item: CardDetail,callBack?: Function )  {
    LoadingMask.show('正在刷新...');
    let ids: string[] = [];
    try {
        let res: AxiosResponse<any>;
        let data;

        res = await apiOperateCard({
            ids: item.id
        });
        data = res.data;
        if (data.code === 200) {
            // ids.push(data.data.id);
            callBack && callBack()
            Message.success(data.msg ?? '操作失败');
        } else {
            Message.warning(data.msg ?? '操作失败');
        }
    } catch (e: any) {
        Message.error(e.message ?? '刷新失败');
    } finally {
        LoadingMask.hide();
    }
}